#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>


struct ListNode 
{
    int val;
    struct ListNode *next;
};
 
struct ListNode* swapPairs(struct ListNode* head)
{
    struct ListNode newhead;
    newhead.next = head;
    struct ListNode* cur = &newhead;
    while (cur->next != NULL && cur->next->next != NULL)
    {
        struct ListNode* p1 = cur->next;
        struct ListNode* p2 = cur->next->next;
        cur->next = p2;
        p1->next = p2->next;
        p2->next = p1;
        cur = p1;
    }
    return newhead.next;
}